package com.ice.day726.thread;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.locks.LockSupport;

import static java.lang.Thread.sleep;

/**
 * @Author ice2020x
 * @Date 2022-08-02 17:00
 * @Description:
 */
@Slf4j
public class ThreadTest12 {
    public static void main(String[] args) {
        try {
            test3();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }


    private static void test3() throws InterruptedException {
        Thread t1 = new Thread(() -> {
            log.debug("park...");
            LockSupport.park();
            log.debug("unpark...");
            log.debug("打断状态：{}", Thread.interrupted());


            LockSupport.park();
            System.out.println("unpark");
        }, "t1");
        t1.start();
        sleep(5000);
        t1.interrupt();
    }
}